<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="js/move.js"></script>
	<title>Insert new twitt</title>
	
	<script type="text/javascript">
var news = null;
window.onload = function ()
{
	if(news == null)
	{
		news = 10;
		localStorage.setItem("news", 10);
	}else
	{
		news = localStorage.getItem("news");
		if(news > 10)
		{
			document.getElementById("insertInfo").style.display = "none";
			document.getElementById("insertInfo").value = "Cannot Insert";
		}
	}
}

function restCheck(flag, form)
{
	if(flag)
	{
		news -= 1;
		localStorage.setItem("news", news);
		
		var currTime = new Date();
		form.postdate.value = "" + currTime.getFullYear() + "" + currTime.getMonth() + "" + currTime.getDate() + "" + currTime.getDay() + "" + currTime.getHours() + "" + currTime.getMinutes() + "" + currTime.getSeconds();
	}
}
</script>
</head>
<body>
	<h1>Fill the Blank with new Twitt Information</h1>
	<p>
	This page supported only 10 new twitts to insert although application has the delete event.
	</p>
	<div id="insertInfo">
	<form method="post" onsubmit="return restCheck(checkNewTwitt(this), this);" action="insert.do">
		<div>id <input type="text" name="id"></div>
		<div>Twitt URL <input type="text" name="url"></div>
		<div>contesnts <input type="text" name="contents"></div>
		<div>link Info <input type="text" name="linkInfo"></div>
		
		<input type="hidden" name="postdate">
		<input type="submit" value="insert">
	</form>
	</div>
	<input type="button" value="home" onclick="location.href='/index.html'">
</body>
</html>